package com.javayh.webServer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author Dylan Yang
 * @Title: WebService
 * @ProjectName lucky
 * @Description: TODO
 * @date 2018/10/220:28
 */
@RestController
@RequestMapping(value = "/ribbon/")
public class WebService extends BaseService{

    /**
      * 通过注册中心调用远程接口;查询所有用户对应的角色信息
      * @author Dylan Yang
      */
    @GetMapping("/getWebService")
    public ResponseEntity getWebService() {
//        return restTemplate.getForEntity("http://lucky-core/user/queryUserAndRoleAll",List.class).getBody();
        return restTemplate.postForEntity("http://LUCKY-CORE/user/queryUserAndRoleAll",String.class,String.class);
    }

    /**
      * 测试不注册的访问
      * @author Dylan Yang
      */
    @GetMapping("/getRibbon")
    public String getBaidu() {
        return restTemplate.getForEntity("http://www.baidu.com/", String.class).getBody();
    }
}

